<template>
  <div class="employee-add">
    <div class="employee-add-wrap">
      <div class="add-title-wrap">
        <div class="back-btn-wrap" >
            <div class="back-btn" @click="back">
              <Icon type="ios-arrow-back" size="20" />返回
            </div>
        </div>
        <div class="route-wrap">
          <span class="route-item" 
          v-for="(item, index) in nav" :key="index" 
          :class="{'route-active':active == index}"
          @click="changeNav(item.path)"
          >
            {{item.name}}
          </span>
        </div>
      </div>
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
export default {
  name: "employee-add",
  data() {
    return {
     
      nav:[
        {
          name:"添加员工",
          path:"/personnel/relation/enrollment/add/employee"
        },
        // {
        //   name:"添加待入职",
        //   path:"/personnel/relation/enrollment/add/candidate"
        // }
      ]
    };
  },
  methods: {
    back(){
      this.$router.back(-1)
    },
    changeNav(path){
    this.$router.push(path)
    }
  },
  computed: {
    active(){
       let currentRoute = this.$route.matched[this.$route.matched.length-1].path;
       if (currentRoute.includes("candidate")){
         return 1
       }else{
         return 0
       }
    }
  },
};
</script>
<style lang="scss" scoped src="./add.scss">
</style>